﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using TalentDesk.Contracts.Ef;
using TalentDesk.Contracts.ServiceContracts;
using TalentDesk.WcfService.EFQueries;

namespace TalentDesk.WcfService.Implementation
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    internal class AuthenticationService : ProjectBaseClass, IAuthenticationService
    {

        public User AuthenticateUser(string userName, string password)
        {
            return AuthenticationServiceEFQueries.AuthenticateUser_CQ(TalentDeskContext, userName, password).AsEnumerable().FirstOrDefault();
        }




        public int SaveUser(User p_oUser)
        {
            throw new NotImplementedException();
        }

        public User GetUsersByUserNamePassword(string p_sUserName, string p_sPassword)
        {
            throw new NotImplementedException();
        }

        public List<User> GetUsers(bool? p_bIsActive = null)
        {
            return TalentDeskContext.Users.Where(p => p.IsActive == p_bIsActive).ToList();
        }

        public User GetUser(int p_iUserId, bool P_bIsIncludeRole = false)
        {
            throw new NotImplementedException();
        }

        public User AddDeleteUserRole(List<int> p_lDeleteRoleId, List<int> p_lAddRoleId, int p_iUserId, int p_iProcessingUserId)
        {
            throw new NotImplementedException();
        }

        public List<Role> GetRoles()
        {
            throw new NotImplementedException();
        }

        public List<Controller> GetControllers()
        {
            throw new NotImplementedException();
        }

        public Controller GetControllerByControllerId(int p_iControllerId)
        {
            throw new NotImplementedException();
        }

        public Controller SaveController(Controller p_oController)
        {
            throw new NotImplementedException();
        }

        public List<Contracts.Ef.Action> GetActions()
        {
            throw new NotImplementedException();
        }

        public List<Contracts.Ef.Action> GetActionsByControllerId(int p_iControllerId)
        {
            throw new NotImplementedException();
        }

        public Contracts.Ef.Action GetActionByActionId(int p_iActionId)
        {
            throw new NotImplementedException();
        }

        public Contracts.Ef.Action SaveAction(Contracts.Ef.Action p_oAction)
        {
            throw new NotImplementedException();
        }

        public List<Menu> GetMenus(bool? p_bIsActive = true)
        {
            return AuthenticationServiceEFQueries.GetMenus_CQ(TalentDeskContext, (bool)p_bIsActive).AsEnumerable().ToList();
        }

        public List<Menu> GetMainMenus(bool? p_bIsActive = true)
        {
            throw new NotImplementedException();
        }

        public List<Menu> GetSubMenus(int p_iParentMenuId, bool? p_bIsActive = true)
        {
            throw new NotImplementedException();
        }

        public Menu SaveMenu(Menu p_oMenu)
        {
            throw new NotImplementedException();
        }

        public Menu GetMenusByMenuId(int p_iMenuId)
        {
            throw new NotImplementedException();
        }
    }
}
